<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>创建表</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0" />
    <#include "/view/admin/head.html"/>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/silviomoreto-bootstrap-select20151109/dist/css/bootstrap-select.css.map" />
    <link rel="stylesheet" type="text/css"  href="${base}/jstool/silviomoreto-bootstrap-select20151109/dist/css/bootstrap-select.min.css"/>
    <script type="text/javascript" src="${base}/jstool/silviomoreto-bootstrap-select20151109/dist/js/bootstrap-select.min.js">
    </script>
    <style type="text/css">
        .table-class{
            width:90%;
            text-align: center;
            border:1px solid #afd9ee;
            margin:0 auto;
            margin-top: 50px;
        }
        .list-path{
            height: 50px;
            line-height: 50px;
            background-color: #9acfea;

        }
        table th{
            text-align: center;
        }
        table thead tr {
            background-color: #9acfea;
        }
        .table-query{
            /*height: 40px;*/
            /*width:80px;*/
            /*text-align: center;*/
            white-space:nowrap;
            /*position: relative;*/
            float: left;
            display:inherit;
            /*display: inline;*/


        }
        .template-muban{
            /*display: inline;*/
            /*position: relative;*/
            float: right;
            margin-top:25px;
            margin-right: 30px;

        }
        .label-head{
            height: 60px;
            width: 100%;
        }
        .label-hidden{
            display: none;
        }
    </style>
    <script type="text/javascript">
        $(function () { $("[data-toggle='tooltip']").tooltip(); });
        function query(dm){
            var val = $('#q').val();
            location.href='${base}/datasource/list.do?q='+val;
        }

        function generate(){
            location.href="${base}/generate/createTableSql.do?tablename="+$('#tablename').val();

        }
        function importSql(){
            $('#form2').attr("action","${base}/generate/importSql.do");
//            alert($('#tablename').val());
//          $('#form1').submit();
          $('#form2').submit();
        }
        function downloadTemplate(){
            $('#form2').attr("action","${base}/generate/downloadTemplate.do");
            $('#form2').submit();
        }

    </script>
</head>
<body>

<div class="list-path" > <span style="margin-left: 50px;"><span class="glyphicon glyphicon-home"></span> 创建表</span></div>

<div class="table-class">
    <#if msg??>
        <div class="alert alert-error"
             style="background-color: #f2dede; color: #a94442;">
            <a class="close" data-dismiss="alert">×</a> <strong>错误!</strong>${msg!}
        </div>
    </#if>
    <#if failed??>
        <div class="alert alert-error"
             style="background-color: #f2dede; color: #a94442;">
            <a class="close" data-dismiss="alert">×</a> <strong>错误!</strong>${msg!}
        </div>
    </#if>
    <#if success??>
        <div class="alert alert-success">
            <a href="#" class="close" data-dismiss="alert">&times;</a>${success!}</div>
    </#if>
    <div class="input-group table-query" style="margin-top:50px;margin-left: 50px;">
        <form id="form2" action="${base}/generate/importSql.do" method="post">
            <div class="form-group" >

                <select class="form-control selectpicker"   data-live-search="true" name="tablename" id="tablename" style="width:400px;">
                    <#if classNameList??>
                        <#list classNameList as c>
                            <option value="${c!}" <#if tablename??&&c==tablename>selected="true"</#if> >${c!}</option>
                        </#list>
                    </#if>



                </select>
            </div>

        <a class="btn btn-info" href="javascript:generate()"> 生成</a>
            <a class="btn btn-info" href="javascript:importSql()"> 导入到数据库</a>
            <a class="btn btn-info" href="javascript:downloadTemplate()"> 导出模板</a>
        </form>

    </div>
    <div class="input-group"><hr/><hr/></div>
    <div class="input-group"  style="height: 600px;width:80%;margin-top:50px;text-align: left;margin-left: 50px;">
        <pre id="label-pre">
${createTableSql!}
        </pre>
    </div>





</div>

</body>
</html>
